Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Infra UI] Propagate flyout state to node details page and some fixes #165956

Conversation

crespocarlos
Copy link
Contributor

@crespocarlos crespocarlos commented Sep 7, 2023

closes #164300

Summary

This PR enables state propagation between asset details flyout and full page view.

navigate_to_full_page.mov

There are other places in Kibana that redirect to node details outside the infra plugin such as APM and Observability/Overview. They use the link-to/${assetType}-detail path, so It's best, for now, to keep retro-compatibility with this route and propagate the state via query string.

I've also refactored how we were persisting state via route navigation, to use native the state attribute found in the location object from react-router

How to tests

  • Start a Kibana instance
  • Navigate to Infrastructure > Host
    • Open the flyout, click in one of the tabs, and click on "Open as Page". The page should open in the same state as the flyout.

@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • /oblt-deploy-serverless : Deploy a serverless Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@crespocarlos crespocarlos force-pushed the 164300-propagate-flyout-state-to-node-details-page branch 2 times, most recently from 269b390 to dcc553e Compare September 7, 2023 12:00
@crespocarlos crespocarlos force-pushed the 164300-propagate-flyout-state-to-node-details-page branch from dcc553e to 0ccb795 Compare September 7, 2023 12:07
@crespocarlos crespocarlos added Feature:Metrics UI Metrics UI feature Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting Feature:ObsHosts Hosts feature within Observability v8.11.0 labels Sep 7, 2023
@crespocarlos crespocarlos force-pushed the 164300-propagate-flyout-state-to-node-details-page branch from 2a57869 to e7b38cf Compare September 7, 2023 14:40
@crespocarlos crespocarlos force-pushed the 164300-propagate-flyout-state-to-node-details-page branch from e7b38cf to 7d2d046 Compare September 7, 2023 15:06
@@ -77,7 +78,7 @@ export const useLinkProps = (
const navigate = () => {
if (navigateToApp) {
const navigationPath = mergedHash ? `#${mergedHash}` : mergedPathname;
navigateToApp(app, { path: navigationPath ? navigationPath : undefined });
navigateToApp(app, { path: navigationPath ? navigationPath : undefined, state });
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaner way of propagating state between routes

Comment on lines 68 to 74
state: {
...(location.pathname
? ({
originAppId: appId,
originSearch: location.search,
originPathname: location.pathname,
} as RouteState)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't go in the querystring anymore, creating a shorter and less polluted query param.

@crespocarlos crespocarlos force-pushed the 164300-propagate-flyout-state-to-node-details-page branch from 73e6404 to 31bf214 Compare September 8, 2023 07:22
@crespocarlos crespocarlos marked this pull request as ready for review September 8, 2023 09:02
@crespocarlos crespocarlos requested review from a team as code owners September 8, 2023 09:02
@elasticmachine
Copy link
Contributor

Pinging @elastic/infra-monitoring-ui (Team:Infra Monitoring UI)

Copy link
Contributor

@shahzad31 shahzad31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obs Shared LGTM !!

@jennypavlova jennypavlova self-requested a review September 8, 2023 09:27
Copy link
Member

@jennypavlova jennypavlova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! The navigation to the node details works as expected when using absolute dates - I found an issue if you go to the Logs tab and change the dates to relative dates (Last 1 hour for example) then enter a search term the navigation is not correct (it is back to the Overview tab):

logs_and_back_issue.mov

I have a question regarding the Back button - if there are changes inside the node details view to the state should we persist those in case the user goes back to the host flyout?

@crespocarlos
Copy link
Contributor Author

hi @jennypavlova , thanks for reviewing this.

I will look into the issue you've found.

I have a question regarding the Back button - if there are changes inside the node details view to the state should we persist those in case the user goes back to the host flyout?

I thought about that too. It could, and it's a matter of what the expectations are. I would say that changes made in the node details view shouldn't persist when the user goes back to the flyout. It appears that a new flow starts when you open it as a page. But we can check with @roshan-elastic what he thinks.

A context provider could be a solution for sharing this state between these 2 flows, but I'm not sure if that would work when the flyout starts being used across Kibana as embeddable. I'm afraid this solution will break.

@crespocarlos
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Member

@jennypavlova jennypavlova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crespocarlos Thanks for the fix, LGTM 💯
Regarding the state - you are right maybe it's better to not persist the state when coming back to the flyout so it's also easier when the flyout is used in different places.

@crespocarlos
Copy link
Contributor Author

Regarding the state - you are right maybe it's better to not persist the state when coming back to the flyout so it's also easier when the flyout is used in different places.

It's a good use case, to be honest. Let's consider this in future discussions.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
observabilityShared 276 277 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
infra 2.0MB 2.0MB +1.1KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
observabilityShared 43.5KB 43.5KB +18.0B
Unknown metric groups

API count

id before after diff
observabilityShared 277 278 +1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@crespocarlos crespocarlos merged commit c6f72c7 into elastic:main Sep 8, 2023
@crespocarlos crespocarlos deleted the 164300-propagate-flyout-state-to-node-details-page branch September 8, 2023 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Metrics UI Metrics UI feature Feature:ObsHosts Hosts feature within Observability release_note:skip Skip the PR/issue when compiling release notes Team:Infra Monitoring UI - DEPRECATED DEPRECATED - Label for the Infra Monitoring UI team. Use Team:obs-ux-infra_services v8.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Infra UI] Hosts view flyout tab should be persisted when the full page is opened
7 participants